Status:  U
Return-Path: <coco-bounces@maltedmedia.com>
Received: from pickering.mail.mindspring.net ([207.69.200.36])
	by mdl-gnash.atl.sa.earthlink.net (EarthLink SMTP Server) with SMTP id 1qpI3c5n13Nl3710; Thu, 26 May 2011 17:25:02 -0400 (EDT)
Received: from five.pairlist.net ([216.92.1.121])
	by pickering.mail.mindspring.net (EarthLink SMTP Server) with ESMTP id 1qpI3bnu3Nl3p20
	for <sfischer1@mindspring.com>; Thu, 26 May 2011 17:25:02 -0400 (EDT)
Received: from five.pairlist.net (localhost [127.0.0.1])
	by five.pairlist.net (Postfix) with ESMTP id 082893BD7B;
	Thu, 26 May 2011 17:25:01 -0400 (EDT)
X-Original-To: coco@lists5.maltedmedia.com
Delivered-To: coco@five.pairlist.net
Received: from deploy5.pair.com (qs281.pair.com [216.92.131.37])
	by five.pairlist.net (Postfix) with SMTP id EE89B3BD4E
	for <coco@lists5.maltedmedia.com>; Thu, 26 May 2011 17:24:59 -0400 (EDT)
Received: (qmail 22343 invoked by uid 3002); 26 May 2011 21:25:00 -0000
Delivered-To: bathory-maltedmedia:com-coco@maltedmedia.com
Received: (qmail 22340 invoked from network); 26 May 2011 21:25:00 -0000
Received: from localhost.pair.com (HELO qs281.pair.com) (127.0.0.1)
	by localhost.pair.com with SMTP; 26 May 2011 21:25:00 -0000
Received: from localhost (localhost [127.0.0.1])
	by qs281.pair.com (Postfix) with SMTP id 13B51D4C5A
	for <coco@maltedmedia.com>; Thu, 26 May 2011 17:25:00 -0400 (EDT)
X-Virus-Check-By: qs281.pair.com
X-Spam-Check-By: qs281.pair.com
X-Spam-Status: No, hits=-2.5 required=5.0 tests=BAYES_00,
	RDNS_DYNAMIC autolearn=no version=3.002005
X-Spam-Flag: NO
X-Spam-Level: 
X-Spam-Filtered: 2339d97e2cf80afbc3f9b452dd9fb067
Received: from brawl.fslf.org (208-38-208-212.mammothnetworks.com
	[208.38.208.212])
	by qs281.pair.com (Postfix) with ESMTP id B970FD4C59
	for <coco@maltedmedia.com>; Thu, 26 May 2011 17:24:57 -0400 (EDT)
Received: from brawl.fslf.org (localhost [127.0.0.1])
	by brawl.fslf.org (8.12.10/8.12.10) with ESMTP id p4QLOv64023230
	for <coco@maltedmedia.com>; Thu, 26 May 2011 15:24:57 -0600
Received: (from goosey@localhost)
	by brawl.fslf.org (8.12.10/8.12.10/Submit) id p4QLOuaW023229
	for coco@maltedmedia.com; Thu, 26 May 2011 15:24:56 -0600
Date: Thu, 26 May 2011 15:24:56 -0600
From: Willard Goosey <goosey@virgo.sdc.org>
To: coco@maltedmedia.com
Message-ID: <20110526212456.GA23191@brawl.fslf.org>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="gKMricLos+KVdGMg"
Content-Disposition: inline
User-Agent: Mutt/1.4.1i
Subject: [Coco] more libs
X-BeenThere: coco@maltedmedia.com
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: CoCoList for Color Computer Enthusiasts <coco@maltedmedia.com>
List-Id: CoCoList for Color Computer Enthusiasts <coco.maltedmedia.com>
List-Unsubscribe: <http://five.pairlist.net/mailman/listinfo/coco>,
	<mailto:coco-request@maltedmedia.com?subject=unsubscribe>
List-Archive: <http://five.pairlist.net/pipermail/coco/>
List-Post: <mailto:coco@maltedmedia.com>
List-Help: <mailto:coco-request@maltedmedia.com?subject=help>
List-Subscribe: <http://five.pairlist.net/mailman/listinfo/coco>,
	<mailto:coco-request@maltedmedia.com?subject=subscribe>
Sender: coco-bounces@maltedmedia.com
Errors-To: coco-bounces@maltedmedia.com
X-ELNK-Received-Info: spv=0;
X-ELNK-AV: 0
X-ELNK-Info: sbv=1; sbrc=-0; sbf=c0; sbw=000;


--gKMricLos+KVdGMg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Window_SaveRestore_fncs.lzh  I haven't used these, I don't know if
they're actually useful or not...

Also, here's my make.default, setnuid.c, and getenv.c

Willard
-- 
Willard Goosey  goosey@sdc.org
Socorro, New Mexico, USA
I search my heart and find Cimmeria, land of Darkness and the Night.
  -- R.E. Howard

--gKMricLos+KVdGMg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="make.default"
Content-Transfer-Encoding: quoted-printable

* Default rules for "make".  This file is read before the "makefile"=0D*   =
 This program is in the Public Domain.=0D*=0D* Compiler name and flags.  Us=
ed by default rules below.=0DCC =3D cc252=0DCFLAGS =3D -dOS9=0DCCFLAGS =3D =
-dOS9=0D* Linker name and flags=0DLINK =3D rlink=0DLFLAGS =3D=0D* Assembler=
 name and flags.=0DRMA =3D rma=0DRFLAGS =3D =0D=0D*generic include-file uti=
lity=0DINCL =3D include=0D=0D*L1 assembler=0DASM =3D asm=0DASIZE =3D \#40K=
=0DAFLAGS =3D u=0D=0D* Pascal name and flags.=0DPC =3D pascal=0DPFLAGS =3D =
\#40K :f=0D*the pound is backslashed to keep make from reading the rest=0D*=
of the line as a comment.=0D*Actual arguements to pascal must be preceded b=
y a : =0D*PFLAGS must contain a : for the O=3D arguement used in the defaul=
t=0D*macro.  =0D*See OS-9 Pascal Reference Manual 2-3 thu 2-5, 3-4, 4-9 thu=
 4-10=0DPTRANS =3D /dd/cmds/pascalt.prun=0DPSINT =3D pascals=0D=0D*AS11 68h=
c11 assembler=0D*doesn't support any flags=0DA11 =3D as11=0D=0D*MASM macro =
assembler=0DMASM =3D masm=0DMFLAGS =3D -L=0D=0D* Directories to use for exe=
cutables and .r files.=0D* Note: ODIR is relative to current exec dir; RDIR=
 is  relative to data dir=0DODIR =3D                              =0DRDIR =
=3D.=0D=0D* When trying to find implicit source files, Make will append eac=
h suffix=0D*   in turn until it finds a source file that exists, and for wh=
ich=0D*   there is a rule defined below.=0D.SUFFIXES: .r .a .c .asm .p .pru=
n .pi .a11 .a11i .masm=0D=0D* .c specifies how to build a no-extension file=
 from a .c file=0D* .c.r specifies how to compile .c files into .r files.=
=0D.c:;$(CC) $(CFLAGS) $(LFLAGS) $< -f=3D$(ODIR/)$@=0D.r:;$(LINK) $(LFLAGS)=
 $< -o=3D$(ODIR/)$@=0D.c.r:;$(CC) $(CFLAGS) -r $<=0D.a.r:;$(RMA) $(RFLAGS) =
$< -o=3D$(RDIR/)$@=0D*=0D.asm:;$(ASM) $(ASIZE) $< $(AFLAGS) o=3D$(ODIR/)$@=
=0D=0D* 08/30/2k4 asm support=0D* because the L1 assembler is necessary for=
 just about anything=0D* that's not a program module=0D=0D* 08/29/2k7 nitro=
s asm support=0D* asm now accepts mixed case labels, IF u option is specifi=
ed=0D* std defs file has mixed case labels. ;-)=0D* also asm very picky abo=
ut option order=0D* must be asm size infile options=0D*=0D.p:;$(PC) $(PFLAG=
S) O=3D$(ODIR/)$@ < $< > $@.lst =0D.p.prun:;$(PC) $(PFLAGS) O=3D$(RDIR/)$@ =
< $< > $*.lst =0D*=0D.pi:;$(INCL) $< ! $(PC) $(PFLAGS) O=3D$(ODIR/)$@ > $@.=
lst =0D.pi.prun:;$(INCL) $< ! $(PC) $(PFLAGS) O=3D$(RDIR/)$@ > $*.lst =0D*=
=0D.prun.asm:;$(PSINT) $(PTRANS) S20K < $*.s=0D* =0D* 09/10/2k1 pascal comp=
iler support (hey why not?)=0D* Note:  notice (and be aware of) the PFLAGS =
hack here.  If pascal=0D* has any arguements, they must be proceded by 1 (a=
nd exactly 1)colon =0D* character.  So, if PFLAGS is changed, LEAVE the : o=
r the O=3D will break!=0D=0D* 07/08/2k8 working on support for pascal nativ=
e code=0D* translator and linkage editor=0D* rules for .p->.prun (source to=
 pcode)=0D* .prun->.asm (pcode to assembly) *note required script file*=0D*=
    then the regular asm->exe rule applies :-)=0D=0D* 3/14/2k9 Pascal with =
Include (foo.pi)=0D*=0D.a11:;$(A11) $< > $*.lst=0D.a11.s19:;$(A11) $< > $*.=
lst =0D          copy m.out $(RDIR/)$@=0D          del m.out=0D.a11i:;$(INC=
L) $< $*.a11=0D       $(A11) $*.a11 > $*.lst=0D       del $*.a11=0D.a11i.s1=
9:;$(INCL) $< $*.a11=0D           $(A11) $*.a11 > $*.lst=0D           copy =
m.out $(RDIR/)$@=0D           del m.out $*.a11=0D=0D*3/13/2k9 as11 support=
=0D*as11 accepts no flags, always writes list file to stdout=0D*and output =
into an s19 file named m.out=0D=0D.masm:;$(MASM) $< $(MFLAGS),o=3D$(ODIR/)$=
@=0D*7/24/2k9 masm support=0D*masm is a very powerful, if old school, macro=
 assembler=0D*masm options seperated by commas, not spaces.  Beware=0D=0D* =
          =0D* Notes: RDIR support here is a bit of a hack.  A macro such a=
s=0D*   $(RDIR/) will expand the same as $(RDIR), except that a trailing=0D=
*   slash will be added, but only if RDIR is not null.  So,=0D*   If RDIR =
=3D RELS, then $(RDIR/) will be "RELS/", but if RDIR =3D=0D*   then $(RDIR/=
) will be null.=0D=0D=0D=0D
--gKMricLos+KVdGMg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="getenv.c"
Content-Transfer-Encoding: quoted-printable

/*=0D "getenv.c" - environment variable reading/setting functions.=0D updat=
ed 8/6/90 by Mike Sweet=0D updated 12/11/2k9 by Willard Goosey=0D ---compar=
e with the length of the string were looking for=0D ---not the string from =
_ENVFILE=0D*/=0D/*#define DEBUG 1*/=0D=0Dchar *_ENVFILE=3D0; /* this global=
 pointer holds the current ENV.FILE contents. */=0Dstatic char envstr[81];=
=0D=0Dstatic char *readenv()=0D{=0D register int path,len;=0D=0D if (!(_ENV=
FILE=3Dmalloc(1024)))=0D  return(0);=0D=0D if ((path=3Dopen("/dd/sys/env.fi=
le",1))=3D=3D-1)=0D  {=0D   free(_ENVFILE);=0D   _ENVFILE=3D0;=0D   return(=
0);=0D  };=0D=0D if ((len=3Dread(path,_ENVFILE,1023))<0)=0D  {=0D   close(p=
ath);=0D   free(_ENVFILE);=0D   _ENVFILE=3D0;=0D   return(0);=0D  };=0D=0D =
_ENVFILE[len]=3D0;=0D close(path);=0D return(_ENVFILE);=0D}=0D=0D=0D=0Dstat=
ic char *findenv(s)=0Dchar *s;=0D{=0D char *temp;=0D register int len;=0D=
=0D if (!_ENVFILE)=0D  readenv();=0D=0D temp=3D_ENVFILE;=0D=0D while (temp)=
=0D  {=0D   if (temp[0]!=3D'*') /* ignore commented lines */=0D    {=0D    =
 len=3D0;=0D     while ((temp[len]!=3D' ') && (temp[len]!=3D'=3D'))=0D     =
 len++;=0D/*do this compare with len(s) chars, not len(temp) chars*/=0D    =
 if (strnucmp(temp,s,strlen(s))=3D=3D0)=0D      {=0D#ifdef DEBUG=0D      pr=
intf("matched %s with %s",s,temp);=0D#endif=0D       temp+=3Dlen;=0D       =
while (*temp && *temp!=3D'=3D')=0D        temp++;=0D       temp++;=0D      =
 while (*temp && *temp=3D=3D' ')=0D        temp++;=0D       return(temp);=
=0D      };=0D    };=0D   if (temp=3Dstrchr(temp,13))=0D    temp++;=0D  };=
=0D return(0);=0D}=0D=0D=0Dchar *getenv(s)=0Dchar *s;=0D{=0D register char =
*temp;=0D=0D temp=3Dfindenv(s);=0D strncpy(envstr,temp,(char *)strchr(temp,=
13)-temp);=0D return(envstr);=0D} =0D=0D=0D=0Dputenv(v,s)=0Dchar *v,*s;=0D{=
=0D register char *temp;=0D int len,slen,path;=0D=0D slen=3Dstrlen(s);=0D=
=0D if (temp=3Dfindenv(v))=0D  {=0D   len=3D(char *)strchr(temp,13)-temp;=
=0D   movemem(temp+slen,temp+len,strlen(temp+len)+1);=0D   movemem(temp,s,s=
len);=0D  }=0D else if (_ENVFILE)=0D  {=0D   if ((strlen(v)+strlen(_ENVFILE=
)+slen+2)>1023)=0D    return;=0D   strcat(_ENVFILE,v);=0D   strcat(_ENVFILE=
,"=3D");=0D   strcat(_ENVFILE,s);=0D   strcat(_ENVFILE,"\n");=0D  }=0D else=
=0D  return;=0D=0D if ((path=3Dopen("/dd/sys/env.file",2))=3D=3D-1)=0D  ret=
urn;=0D=0D write(path,_ENVFILE,strlen(_ENVFILE));=0D close(path);=0D return=
;=0D}=0D
--gKMricLos+KVdGMg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="setnuid.c"

/*setnuid() for UNIXLIB
 *
 *Willard Goosey
 *goosey@sdc.org
 *12/12/2010
 *
 * int setnuid(n)
 * returns old uid or -1 on failure
 * sets uid = n
 * under OS-9/6X09, setuid system call always succeeds
 * but setuid() C call only allows success if uid already = 0
 * OS-9/6X09 is normally run by user 0 anyway...
 * but this gives no indication if setuid() fails.
 */

/*Kreider C lib has asetuid() which always succeeds so we can
 *use it here if we're using Kreider's C lib.  If you're not,
 *you should be.
 *1/12/2011
 *set the #define if you are using Kreider's lib 1/23/2011
 */
#define KREIDER

int setnuid(n)
    int n;
{
    int old,r;

    old=getuid();
#ifdef KREIDER
    asetuid(n);
#else
    r=setuid(n);
    if(r<0) 
      old=r;
#endif
    return old;
}
--gKMricLos+KVdGMg
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--
Coco mailing list
Coco@maltedmedia.com
http://five.pairlist.net/mailman/listinfo/coco

--gKMricLos+KVdGMg--